//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Lesser General Public License for more details.
// 
// You should have received a copy of the GNU Lesser General Public License
// along with this program.  If not, see http://www.gnu.org/licenses/.
// 

package final;

network Net
{
        @display("bgb=746,509");
    types:
        channel ChannelIn extends ned.DatarateChannel
        {
                datarate = 10Gbps;
        }
        channel ChannelOut extends ned.DatarateChannel
        {
                datarate = 10Gbps;
        }
        
        
    submodules:
        sourceA[4]: Src {
                
                @display("i=old/comp2");
        }
        sourceB[4]: Src {
                
                @display("i=old/comp2");
        }
        switch[2]: Switch {
                
                
                @display("i=block/switch");
        }
    connections:
        
        switch[0].out[0] --> ChannelIn --> sourceA[0].in;
        sourceA[0].out --> ChannelOut --> switch[0].in[0];
        
        
        switch[0].out[2] --> ChannelIn --> sourceA[2].in;
        sourceA[2].out --> ChannelOut --> switch[0].in[2];
        
        switch[0].out[3] --> ChannelIn --> sourceA[3].in;
        sourceA[3].out --> ChannelOut --> switch[0].in[3];
        
        switch[0].in[1] <-- ChannelOut <-- sourceA[1].out;
        switch[0].out[1] --> ChannelIn --> sourceA[1].in;
        
        
        switch[1].out[0] --> ChannelIn --> sourceB[0].in;
        sourceB[0].out --> ChannelOut --> switch[1].in[0];
        
        
        switch[1].out[2] --> ChannelIn --> sourceB[2].in;
        sourceB[2].out --> ChannelOut --> switch[1].in[2];
        
        switch[1].out[3] --> ChannelIn --> sourceB[3].in;
        sourceB[3].out --> ChannelOut --> switch[1].in[3];
        
        switch[1].in[1] <-- ChannelOut <-- sourceB[1].out;
        switch[1].out[1] --> ChannelIn --> sourceB[1].in;
        
        switch[0].out[4] --> ChannelOut --> switch[1].in[4];
        switch[1].out[4] --> ChannelIn --> switch[0].in[4];
        
        
        
}
